<script setup>
import {computed} from "vue";

const props = defineProps({
  col: {
    type: Number,
    default: () => 2,
  },
  list: {
    type: Array,
    default: () => []
  },
  gap: {
    type: String,
    default: () => '24px',
  }
})
const optList = computed(() => {
  const {list, col} = props
  const result = []
  list.forEach((item, index) => {
    const resultIndex = index % col
    if (!result[resultIndex]) result[resultIndex] = []
    result[resultIndex].push(item)
  })
  return result
})
</script>

<template>
  <div class="water-full-wrapper" :style="{gap:gap}">
    <div class="water-full-col-item"
         v-for="(item,index) in optList"
         :key="index"
         :style="{gap:gap}"
    >
      <div class="col-list-item" v-for="(col,colIndex) in item" :key="colIndex">
        <slot :record="col"/>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.water-full-wrapper {
  width: 100%;
  height: fit-content;
  display: flex;
  flex-flow: row nowrap;

  .water-full-col-item {
    flex: 1;
    display: flex;
    flex-flow: column;

    .col-list-item {

    }
  }
}
</style>
